
# !/usr/bin/env python
# -*-coding:utf-8 -*-

"""
# Author     ：xialang333@gmail.com
# Time       ：2024/4/13 10:07
# Description：
"""
import time


from rest_framework import serializers

from utils.jsonResponse import SuccessResponse
from utils.serializers import CustomModelSerializer
from utils.viewset import CustomModelViewSet
from apps.crond.models import TaskResult

class  TaskDetailSerializer(CustomModelSerializer):
    """定时任务详情 序列化器"""
    # finished = serializers.SerializerMethodField()

    # def get_finished(self, instance):
    #     local = time.localtime(int(instance.finished))
    #     local = time.strftime("%Y-%m-%d %H:%M:%S", local)
    #     return local

    class Meta:
        model = TaskResult
        fields = "__all__"


class TaskDetailViewSet(CustomModelViewSet):
    """
    定时任务
    """
    queryset = TaskResult.objects.all()
    serializer_class = TaskDetailSerializer
    search_fields = ('job_id',)

